package com.net.oil.car.presenter;

import com.net.oil.base.BasePresenter;
import com.net.oil.car.bean.CarBean;
import com.net.oil.car.contract.MyCarDetailContract;
import com.net.oil.car.model.MyCarDetailModel;

import java.util.List;

/**
 * 作者：lch
 * 时间：2018/4/10 0010:下午 15:39
 * 邮箱：245850413@qq.com
 * 说明：
 */

public class MyCarDetailPresenter extends BasePresenter<MyCarDetailContract.View> implements MyCarDetailContract.Presenter {

    private MyCarDetailContract.View view;
    private MyCarDetailContract.Model model;

    public MyCarDetailPresenter(MyCarDetailContract.View view) {
        this.view = view;
        model = new MyCarDetailModel(this);
    }

    @Override
    protected void unSubscribe() {
        model.unSubscribe();
    }

    @Override
    public void addCar(int carTypeId, String carNum) {
        model.addCar(carTypeId, carNum);
    }

    @Override
    public void addCarSuccess() {
        view.addCarSuccess();
    }

    @Override
    public void addCarFailed() {
        view.addCarFailed();
    }

    @Override
    public void getMyCarList() {
        model.getMyCarList();
    }

    @Override
    public void getMyCarListSuccess(List<CarBean> carBeans) {
        view.getMyCarListSuccess(carBeans);
    }

    @Override
    public void getMyCarListFailed() {
        view.getMyCarListFailed();
    }

    @Override
    public void setDefaultCarSuccess() {
        view.setDefaultCarSuccess();
    }

    @Override
    public void setDefaultCarFailed() {
        view.setDefaultCarFailed();
    }

    @Override
    public void setDefaultCar(int id) {
        model.setDefaultCar(id);
    }

    @Override
    public void deleteCarSuccess() {
        view.deleteCarSuccess();
    }

    @Override
    public void deleteCarFailed() {
        view.deleteCarFailed();
    }

    @Override
    public void deleteCar(int id) {
        model.deleteCar(id);
    }

    @Override
    public void updateCarInfo(int id, String registNumber, int modelId, String buyTime, int mileage,
                              String identificationCode, String oilName, String gearboxOilName, String nextKeepCarDate) {
        model.updateCarInfo(id, registNumber, modelId, buyTime, mileage, identificationCode, oilName, gearboxOilName, nextKeepCarDate);
    }

    @Override
    public void updateCarInfoSuccess() {
        view.updateCarInfoSuccess();
    }

    @Override
    public void updateCarInfoFailed() {
        view.updateCarInfoFailed();
    }
}
